#ifndef FROMCOMPONENT_H
#define FROMCOMPONENT_H

#include <string>
using namespace std;

/*
    Class: FromComponent.
    Represents a component of a SQL From clause by the name of the SQL View of Table, and its rename.
*/
class FromComponent
{
    /* Section: public */
    public:
        /*
            Constructor: Default constructor.
            Initializes the object.

            Paramenters:
                name    -   Name of the SQL Table or View ("" by default).
                rename  -   Rename of the SQL Table or View ("" by default).
        */
        FromComponent(const string & name = "", const string & rename = "");

        /*
            Destructor: Defautl destructor.
            Destroy the object.
        */
        virtual ~FromComponent();

        /*
            Constructor: Copy constructor.
            Initializes the object as a copy of other FromComponent object.

            Parameters:
                other   -   FromComponent to copy from.
        */
        FromComponent(const FromComponent& other);

        /*
            Method: SetName
            Sets the real name of the SQL table o View that is referenced by the FromComponent.

            Parameters:
                name    -   Name of the SQL Table or View.
        */
        void setName(const string & name);

        /*
            Method: SetRename
            Sets the rename of a SQL Table or View.

            Parameters:
                rename  -   Rename for the SQL Table or View.
        */
        void setRename(const string & rename);

        /*
            Method: GetName
            Returns:
                The name of the SQL Table or View reference by the FromComponent.
        */
        string getName();

        /*
            Method: GetRename
            Returns:
                The rename of the SQL View or Table.
        */
        string getRename();

        /*
            Method: ToString
            Returns:
                A string representation of the FromComponent object.
        */
        string toString();

        /*
            Method: clone
            Returns:
                A clone of this object
        */
        FromComponent * clone();

    /* Section: private */
    private:
        /*
            Variable: name
            Type: string
            Name of the referenced SQL Table or View.
        */
        string name;

        /*
            Variable: rename
            Type: string
            Rename for the referencef SQL Table or View.
        */
        string rename;
};

#endif // FROMCOMPONENT_H
